package com.probiz.estore.common.model.customer;

import org.apache.commons.lang.StringUtils;

import com.probiz.estore.common.model.customer.base.FeedbackTbl;

/**
 * Model class for Feedback. Add not database mapped fileds in this class.
 */
public class Feedback extends FeedbackTbl {
	
	/*
	 * MY_FEEDBACK_LIST - 我发表的反馈列表
	 */
	public static enum FilterHqlName{MY_FEEDBACK_LIST};
	
	public static Short STATUS_READ = (short)1; //已读
	public static Short STATUS_UNREAD = (short)0; //未读
	public static Short STATUS_SHOW = (short)1; //显示
	public static Short STATUS_UNSHOW = (short)0; //隐藏
	public static Integer STATUS_TOP = 0; //置顶
	public static Integer STATUS_UNTOP = 10; //非置顶
	public static Short STATUS_REPLY = (short)1; //已回复
	public static Short STATUS_UNREPLY = (short)0; //等待回复
  	/**
  	 * 获得发出反馈人名称
  	 * @return
  	 */
  	public String getFeedbackUserName(){
		if(null != customer){
			return customer.getFullName();
		}else{
			return customerName;
		}
	}
  	
  	/**
	 * 获得反馈人地域地理位置
	 * @return
	 */
	public String getFeedbackUserArea(){
		String area = "";
		if (StringUtils.isNotBlank(this.getAddress())) {
			String[] addresses = this.getAddress().split(" ");
			area = addresses[0];
		}
		return area;
	}
  	/**
	 * Default Empty Constructor for class Feedback
	 */
	public Feedback () {
		super();
	}
	
	/**
	 * 定义实体的业务名取值； feedbackName
	 * 必须手工完成这个部分，否则编译不通过。
	 */
	public String getFeedbackName () {
		if (feedbackId == null)
	        return "";
	    else
			//返回一个指定有业务意义的属性值;
			//如：product的VO就用product.productName
	        return this.subject;
	}
	
	/**
	 * Default Key Fields Constructor for class Feedback
	 */
	public Feedback (
		 Integer in_feedbackId
		) {
		super (
		  in_feedbackId
		);
	}

}
